package com.flash.dailyreport.controller;

import com.flash.dailyreport.entity.HousepriceEntity;
import com.flash.dailyreport.service.HousepriceService;
import com.flash.dailyreport.util.HttpClientUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Arrays;
import java.util.List;

/**
 * @author sunyiming
 * @date 2018/8/17
 */
@Controller
@RequestMapping("houseprice")
public class HousepriceController {

    @Autowired
    HousepriceService housepriceService;

    HttpClientUtils client = HttpClientUtils.getInstance();

    @RequestMapping("list")
    @ResponseBody
    public List<HousepriceEntity> list() {
        List<HousepriceEntity> housepriceEntities = housepriceService.listAll();
        for (HousepriceEntity h : housepriceEntities) {
            String print = String.format("城市：%s 房价：%s 数量：%s", h.getCityname(), h.getPrice(), h.getSupplyCount());
            System.out.println(print);
        }
        return housepriceEntities;
    }

}
